import xadmin
from xadmin import views
from account.models import EmailVerifyRecord, Banner


class BaseSetting:
    enable_themes = True
    use_bootswatch = True


class GlobalSettings:
    site_title = "Bachelor后台管理系统"
    site_footer = '学霸鸽在线网'
    menu_style = 'accordion'


class EmailVerifyRecordAdmin:
    list_display = ('code', 'email', 'verify_type', 'send_time')
    search_fields = ('code', 'email', 'verify_type')
    list_filter = ('code', 'email', 'verify_type', 'send_time')


class BannerAdmin:
    list_display = ('title', 'image', 'url', 'created', 'updated')
    search_fields = ('title', 'image', 'url',)
    list_filter = ('title', 'image', 'url', 'created', 'updated')


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
